package cn.gson.boot.controller;

import cn.gson.boot.model.pojos.*;
import cn.gson.boot.model.service.CaringService;
import cn.gson.boot.model.service.KaiPiaoService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/kaipiao")
public class KaiPiaoController {
    @Autowired
    KaiPiaoService kaiPiaoService;

    @RequestMapping("/selectKaiPiaoByddId")
    @ResponseBody
    //根据订单id找到此订单的所有开票记录
    public List<Kaipiao> selectKaiPiaoByddId(Integer ddId){
        return kaiPiaoService.selectKaiPiaoByddId(ddId);
    }

    @RequestMapping("/addKaiPiao")
    @ResponseBody
    //新增开票记录
    public void addKaiPiao(@RequestBody Kaipiao kaipiao){
        kaiPiaoService.addKaiPiao(kaipiao);
    }

    @RequestMapping("/selectKaiPiaoEmp")
    @ResponseBody
    //查开票员工
    public List<User> selectKaiPiaoEmp(){
        return kaiPiaoService.selectKaiPiaoEmp();
    }


    @RequestMapping("/selectKaiPiaoByhkId")
    @ResponseBody
    //根据回款id查看开票记录
    public Kaipiao selectKaiPiaoByhkId(Integer hkId){
        return kaiPiaoService.selectKaiPiaoByhkId(hkId);
    }

}
